/* GUI CONVERTED from rechmt.p (converter v1.75) Sat Aug 12 23:05:02 2000 */
/* rechmt.p - PRODUCTION LINE CHANGE-OVER MAINTENANCE                   */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 7.0             LAST MODIFIED: 02/25/92 BY: SMM *F230      */
/* REVISION: 7.0             LAST MODIFIED: 03/29/92 BY: emb *F331      */
/* REVISION: 7.5             LAST MODIFIED: 10/24/94 BY: mwd *J034*     */
/* REVISION: 7.3             LAST MODIFIED: 01/29/96 BY: jym *G1LJ      */
/* REVISION: 8.6             LAST MODIFIED: 05/20/98 BY: *K1Q4* Alfred Tan */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb               */
/************************************************************************/
/*J034*  ** MOVED MFDTITLE.I UP FROM BELOW */
     {mfdtitle.i "b+ "}

define variable del-yn as logical.
define variable des1   like pt_desc1.
define variable des2   like pt_desc1.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
  
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
chg_site   colon 30 si_desc no-label
  chg_line   colon 30 ln_desc no-label
  skip(1)
  chg_from   colon 30 des1 no-label
  chg_to     colon 30 des2 no-label
  skip(1)
  chg_time   colon 30
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/*J034*/ mainloop:
repeat on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.


   prompt-for chg_site chg_line chg_from chg_to with frame a editing:

     {mfnp.i chg_mstr chg_line chg_line chg_site chg_site chg_line}

     if recno <> ? then do with frame a:

    display chg_line chg_site chg_from chg_to chg_time with frame a.

    find ln_mstr no-lock where ln_line = chg_line
       and ln_site = chg_site no-error.
    if available ln_mstr then display ln_desc. else display "" @ ln_desc.

    find si_mstr where si_site = chg_site no-lock no-error.
    if available si_mstr then display si_desc. else display "" @ si_desc.

    find pt_mstr where pt_part = chg_from no-lock no-error.
    if available pt_mstr then display pt_desc1 @ des1.
    else display "" @ des1.

    find pt_mstr where pt_part = chg_to  no-lock no-error.
    if available pt_mstr then display pt_desc1 @ des2.
    else display "" @ des2.

     end.
   end.

   find si_mstr no-lock where si_site = input chg_site no-error.
   if not available si_mstr then do:
      {mfmsg.i 708 3} /* SITE DOES NOT EXIST */
      undo, retry.
   end.

/*J034*/ {gprun.i ""gpsiver.p""
     "(input si_site, input recid(si_mstr), output return_int)"}
/*GUI*/ if global-beam-me-up then undo, leave.

/*J034*/ if return_int = 0 then do:
/*J034*/    {mfmsg.i 725 3}     /*USER DOES NOT HAVE ACCESS TO THIS SITE */
/*J034*/    next-prompt chg_site with frame a.
/*J034*/    undo mainloop, retry.
/*J034*/ end.
   find ln_mstr no-lock where ln_line = input chg_line
   and ln_site = input chg_site no-error.
   if not available ln_mstr then do:
      {mfmsg.i 8526 3}
      next-prompt chg_line with frame a.
      undo, retry.
   end.

/*G1LJ*/ if input chg_from <> "" then do:
   find first lnd_det no-lock
   where lnd_line = input chg_line
   and lnd_site = input chg_site
   and lnd_part = input chg_from no-error.

   if not available lnd_det then do:
      {mfmsg.i 8527 3}
      next-prompt chg_from with frame a.
      undo, retry.
   end.
/*G1LJ*/ end. /* INPUT CHG_FROM <> "" */

   find first lnd_det no-lock
   where lnd_line = input chg_line
   and lnd_site = input chg_site
   and lnd_part = input chg_to no-error.

   if not available lnd_det then do:
      {mfmsg.i 8527 3}
      next-prompt chg_to with frame a.
      undo, retry.
   end.

   display si_desc with frame a.
   display ln_desc with frame a.

   find pt_mstr where pt_part = input chg_from no-lock no-error.
   if available pt_mstr then display pt_desc1 @ des1 with frame a.

   find pt_mstr where pt_part = input chg_to  no-lock no-error.
   if available pt_mstr then display pt_desc1 @ des2 with frame a.

   find chg_mstr exclusive-lock using chg_line and chg_site
   and chg_from and chg_to no-error.
   if not available chg_mstr then do:
      {mfmsg.i 1 1}
      create chg_mstr.
      assign
     chg_line = ln_line
     chg_site = si_site
     chg_from
     chg_to.
   end.

   ststatus = stline[2].
   status input ststatus.
   del-yn = no.

   update chg_time go-on ("F5" "CTRL-D") with frame a.

   if lastkey = keycode("F5")
   or lastkey = keycode("CTRL-D")
   then do:
      del-yn = yes.
      {mfmsg01.i 11 1 del-yn} /*CONFIRM DELETE*/
      if del-yn then do:
     delete chg_mstr.
     clear frame a.
/*GUI*/ RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
      end.
   end.
end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* repeat */
